/*
 * Copyright 2018 Google
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: google/firestore/v1beta1/write.proto

// This CPP symbol can be defined to use imports that match up to the framework
// imports needed when using CocoaPods.
#if !defined(GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS)
 #define GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS 0
#endif

#if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
 #import <Protobuf/GPBProtocolBuffers.h>
#else
 #import "GPBProtocolBuffers.h"
#endif

#if GOOGLE_PROTOBUF_OBJC_VERSION < 30002
#error This file was generated by a newer version of protoc which is incompatible with your Protocol Buffer library sources.
#endif
#if 30002 < GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION
#error This file was generated by an older version of protoc which is incompatible with your Protocol Buffer library sources.
#endif

// @@protoc_insertion_point(imports)

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"

CF_EXTERN_C_BEGIN

@class GCFSArrayValue;
@class GCFSDocument;
@class GCFSDocumentMask;
@class GCFSDocumentTransform;
@class GCFSDocumentTransform_FieldTransform;
@class GCFSPrecondition;
@class GCFSValue;
@class GPBTimestamp;

NS_ASSUME_NONNULL_BEGIN

#pragma mark - Enum GCFSDocumentTransform_FieldTransform_ServerValue

/** A value that is calculated by the server. */
typedef GPB_ENUM(GCFSDocumentTransform_FieldTransform_ServerValue) {
  /**
   * Value used if any message's field encounters a value that is not defined
   * by this enum. The message will also have C functions to get/set the rawValue
   * of the field.
   **/
  GCFSDocumentTransform_FieldTransform_ServerValue_GPBUnrecognizedEnumeratorValue = kGPBUnrecognizedEnumeratorValue,
  /** Unspecified. This value must not be used. */
  GCFSDocumentTransform_FieldTransform_ServerValue_ServerValueUnspecified = 0,

  /**
   * The time at which the server processed the request, with millisecond
   * precision.
   **/
  GCFSDocumentTransform_FieldTransform_ServerValue_RequestTime = 1,
};

GPBEnumDescriptor *GCFSDocumentTransform_FieldTransform_ServerValue_EnumDescriptor(void);

/**
 * Checks to see if the given value is defined by the enum or was not known at
 * the time this source was generated.
 **/
BOOL GCFSDocumentTransform_FieldTransform_ServerValue_IsValidValue(int32_t value);

#pragma mark - GCFSWriteRoot

/**
 * Exposes the extension registry for this file.
 *
 * The base class provides:
 * @code
 *   + (GPBExtensionRegistry *)extensionRegistry;
 * @endcode
 * which is a @c GPBExtensionRegistry that includes all the extensions defined by
 * this file and all files that it depends on.
 **/
@interface GCFSWriteRoot : GPBRootObject
@end

#pragma mark - GCFSWrite

typedef GPB_ENUM(GCFSWrite_FieldNumber) {
  GCFSWrite_FieldNumber_Update = 1,
  GCFSWrite_FieldNumber_Delete_p = 2,
  GCFSWrite_FieldNumber_UpdateMask = 3,
  GCFSWrite_FieldNumber_CurrentDocument = 4,
  GCFSWrite_FieldNumber_Transform = 6,
};

typedef GPB_ENUM(GCFSWrite_Operation_OneOfCase) {
  GCFSWrite_Operation_OneOfCase_GPBUnsetOneOfCase = 0,
  GCFSWrite_Operation_OneOfCase_Update = 1,
  GCFSWrite_Operation_OneOfCase_Delete_p = 2,
  GCFSWrite_Operation_OneOfCase_Transform = 6,
};

/**
 * A write on a document.
 **/
@interface GCFSWrite : GPBMessage

/** The operation to execute. */
@property(nonatomic, readonly) GCFSWrite_Operation_OneOfCase operationOneOfCase;

/** A document to write. */
@property(nonatomic, readwrite, strong, null_resettable) GCFSDocument *update;

/**
 * A document name to delete. In the format:
 * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
 **/
@property(nonatomic, readwrite, copy, null_resettable) NSString *delete_p;

/**
 * Applies a tranformation to a document.
 * At most one `transform` per document is allowed in a given request.
 * An `update` cannot follow a `transform` on the same document in a given
 * request.
 **/
@property(nonatomic, readwrite, strong, null_resettable) GCFSDocumentTransform *transform;

/**
 * The fields to update in this write.
 *
 * This field can be set only when the operation is `update`.
 * If the mask is not set for an `update` and the document exists, any
 * existing data will be overwritten.
 * If the mask is set and the document on the server has fields not covered by
 * the mask, they are left unchanged.
 * Fields referenced in the mask, but not present in the input document, are
 * deleted from the document on the server.
 * The field paths in this mask must not contain a reserved field name.
 **/
@property(nonatomic, readwrite, strong, null_resettable) GCFSDocumentMask *updateMask;
/** Test to see if @c updateMask has been set. */
@property(nonatomic, readwrite) BOOL hasUpdateMask;

/**
 * An optional precondition on the document.
 *
 * The write will fail if this is set and not met by the target document.
 **/
@property(nonatomic, readwrite, strong, null_resettable) GCFSPrecondition *currentDocument;
/** Test to see if @c currentDocument has been set. */
@property(nonatomic, readwrite) BOOL hasCurrentDocument;

@end

/**
 * Clears whatever value was set for the oneof 'operation'.
 **/
void GCFSWrite_ClearOperationOneOfCase(GCFSWrite *message);

#pragma mark - GCFSDocumentTransform

typedef GPB_ENUM(GCFSDocumentTransform_FieldNumber) {
  GCFSDocumentTransform_FieldNumber_Document = 1,
  GCFSDocumentTransform_FieldNumber_FieldTransformsArray = 2,
};

/**
 * A transformation of a document.
 **/
@interface GCFSDocumentTransform : GPBMessage

/** The name of the document to transform. */
@property(nonatomic, readwrite, copy, null_resettable) NSString *document;

/**
 * The list of transformations to apply to the fields of the document, in
 * order.
 * This must not be empty.
 **/
@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray<GCFSDocumentTransform_FieldTransform*> *fieldTransformsArray;
/** The number of items in @c fieldTransformsArray without causing the array to be created. */
@property(nonatomic, readonly) NSUInteger fieldTransformsArray_Count;

@end

#pragma mark - GCFSDocumentTransform_FieldTransform

typedef GPB_ENUM(GCFSDocumentTransform_FieldTransform_FieldNumber) {
  GCFSDocumentTransform_FieldTransform_FieldNumber_FieldPath = 1,
  GCFSDocumentTransform_FieldTransform_FieldNumber_SetToServerValue = 2,
  GCFSDocumentTransform_FieldTransform_FieldNumber_NumericAdd = 3,
  GCFSDocumentTransform_FieldTransform_FieldNumber_AppendMissingElements = 6,
  GCFSDocumentTransform_FieldTransform_FieldNumber_RemoveAllFromArray_p = 7,
};

typedef GPB_ENUM(GCFSDocumentTransform_FieldTransform_TransformType_OneOfCase) {
  GCFSDocumentTransform_FieldTransform_TransformType_OneOfCase_GPBUnsetOneOfCase = 0,
  GCFSDocumentTransform_FieldTransform_TransformType_OneOfCase_SetToServerValue = 2,
  GCFSDocumentTransform_FieldTransform_TransformType_OneOfCase_NumericAdd = 3,
  GCFSDocumentTransform_FieldTransform_TransformType_OneOfCase_AppendMissingElements = 6,
  GCFSDocumentTransform_FieldTransform_TransformType_OneOfCase_RemoveAllFromArray_p = 7,
};

/**
 * A transformation of a field of the document.
 **/
@interface GCFSDocumentTransform_FieldTransform : GPBMessage

/**
 * The path of the field. See [Document.fields][google.firestore.v1beta1.Document.fields] for the field path syntax
 * reference.
 **/
@property(nonatomic, readwrite, copy, null_resettable) NSString *fieldPath;

/** The transformation to apply on the field. */
@property(nonatomic, readonly) GCFSDocumentTransform_FieldTransform_TransformType_OneOfCase transformTypeOneOfCase;

/** Sets the field to the given server value. */
@property(nonatomic, readwrite) GCFSDocumentTransform_FieldTransform_ServerValue setToServerValue;

/**
 * Adds the given value to the field's current value.
 *
 * This must be an integer or a double value.
 * If the field is not an integer or double, or if the field does not yet
 * exist, the transformation will set the field to the given value.
 * If either of the given value or the current field value are doubles,
 * both values will be interpreted as doubles. Double arithmetic and
 * representation of double values follow IEEE 754 semantics.
 * If there is positive/negative integer overflow, the field is resolved
 * to the largest magnitude positive/negative integer.
 **/
@property(nonatomic, readwrite, strong, null_resettable) GCFSValue *numericAdd;

/**
 * Append the given elements in order if they are not already present in
 * the current field value.
 * If the field is not an array, or if the field does not yet exist, it is
 * first set to the empty array.
 *
 * Equivalent numbers of different types (e.g. 3L and 3.0) are
 * considered equal when checking if a value is missing.
 * NaN is equal to NaN, and Null is equal to Null.
 * If the input contains multiple equivalent values, only the first will
 * be considered.
 *
 * The corresponding transform_result will be the null value.
 **/
@property(nonatomic, readwrite, strong, null_resettable) GCFSArrayValue *appendMissingElements;

/**
 * Remove all of the given elements from the array in the field.
 * If the field is not an array, or if the field does not yet exist, it is
 * set to the empty array.
 *
 * Equivalent numbers of the different types (e.g. 3L and 3.0) are
 * considered equal when deciding whether an element should be removed.
 * NaN is equal to NaN, and Null is equal to Null.
 * This will remove all equivalent values if there are duplicates.
 *
 * The corresponding transform_result will be the null value.
 **/
@property(nonatomic, readwrite, strong, null_resettable) GCFSArrayValue *removeAllFromArray_p;

@end

/**
 * Fetches the raw value of a @c GCFSDocumentTransform_FieldTransform's @c setToServerValue property, even
 * if the value was not defined by the enum at the time the code was generated.
 **/
int32_t GCFSDocumentTransform_FieldTransform_SetToServerValue_RawValue(GCFSDocumentTransform_FieldTransform *message);
/**
 * Sets the raw value of an @c GCFSDocumentTransform_FieldTransform's @c setToServerValue property, allowing
 * it to be set to a value that was not defined by the enum at the time the code
 * was generated.
 **/
void SetGCFSDocumentTransform_FieldTransform_SetToServerValue_RawValue(GCFSDocumentTransform_FieldTransform *message, int32_t value);

/**
 * Clears whatever value was set for the oneof 'transformType'.
 **/
void GCFSDocumentTransform_FieldTransform_ClearTransformTypeOneOfCase(GCFSDocumentTransform_FieldTransform *message);

#pragma mark - GCFSWriteResult

typedef GPB_ENUM(GCFSWriteResult_FieldNumber) {
  GCFSWriteResult_FieldNumber_UpdateTime = 1,
  GCFSWriteResult_FieldNumber_TransformResultsArray = 2,
};

/**
 * The result of applying a write.
 **/
@interface GCFSWriteResult : GPBMessage

/**
 * The last update time of the document after applying the write. Not set
 * after a `delete`.
 *
 * If the write did not actually change the document, this will be the
 * previous update_time.
 **/
@property(nonatomic, readwrite, strong, null_resettable) GPBTimestamp *updateTime;
/** Test to see if @c updateTime has been set. */
@property(nonatomic, readwrite) BOOL hasUpdateTime;

/**
 * The results of applying each [DocumentTransform.FieldTransform][google.firestore.v1beta1.DocumentTransform.FieldTransform], in the
 * same order.
 **/
@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray<GCFSValue*> *transformResultsArray;
/** The number of items in @c transformResultsArray without causing the array to be created. */
@property(nonatomic, readonly) NSUInteger transformResultsArray_Count;

@end

#pragma mark - GCFSDocumentChange

typedef GPB_ENUM(GCFSDocumentChange_FieldNumber) {
  GCFSDocumentChange_FieldNumber_Document = 1,
  GCFSDocumentChange_FieldNumber_TargetIdsArray = 5,
  GCFSDocumentChange_FieldNumber_RemovedTargetIdsArray = 6,
};

/**
 * A [Document][google.firestore.v1beta1.Document] has changed.
 *
 * May be the result of multiple [writes][google.firestore.v1beta1.Write], including deletes, that
 * ultimately resulted in a new value for the [Document][google.firestore.v1beta1.Document].
 *
 * Multiple [DocumentChange][google.firestore.v1beta1.DocumentChange] messages may be returned for the same logical
 * change, if multiple targets are affected.
 **/
@interface GCFSDocumentChange : GPBMessage

/**
 * The new state of the [Document][google.firestore.v1beta1.Document].
 *
 * If `mask` is set, contains only fields that were updated or added.
 **/
@property(nonatomic, readwrite, strong, null_resettable) GCFSDocument *document;
/** Test to see if @c document has been set. */
@property(nonatomic, readwrite) BOOL hasDocument;

/** A set of target IDs of targets that match this document. */
@property(nonatomic, readwrite, strong, null_resettable) GPBInt32Array *targetIdsArray;
/** The number of items in @c targetIdsArray without causing the array to be created. */
@property(nonatomic, readonly) NSUInteger targetIdsArray_Count;

/** A set of target IDs for targets that no longer match this document. */
@property(nonatomic, readwrite, strong, null_resettable) GPBInt32Array *removedTargetIdsArray;
/** The number of items in @c removedTargetIdsArray without causing the array to be created. */
@property(nonatomic, readonly) NSUInteger removedTargetIdsArray_Count;

@end

#pragma mark - GCFSDocumentDelete

typedef GPB_ENUM(GCFSDocumentDelete_FieldNumber) {
  GCFSDocumentDelete_FieldNumber_Document = 1,
  GCFSDocumentDelete_FieldNumber_ReadTime = 4,
  GCFSDocumentDelete_FieldNumber_RemovedTargetIdsArray = 6,
};

/**
 * A [Document][google.firestore.v1beta1.Document] has been deleted.
 *
 * May be the result of multiple [writes][google.firestore.v1beta1.Write], including updates, the
 * last of which deleted the [Document][google.firestore.v1beta1.Document].
 *
 * Multiple [DocumentDelete][google.firestore.v1beta1.DocumentDelete] messages may be returned for the same logical
 * delete, if multiple targets are affected.
 **/
@interface GCFSDocumentDelete : GPBMessage

/** The resource name of the [Document][google.firestore.v1beta1.Document] that was deleted. */
@property(nonatomic, readwrite, copy, null_resettable) NSString *document;

/** A set of target IDs for targets that previously matched this entity. */
@property(nonatomic, readwrite, strong, null_resettable) GPBInt32Array *removedTargetIdsArray;
/** The number of items in @c removedTargetIdsArray without causing the array to be created. */
@property(nonatomic, readonly) NSUInteger removedTargetIdsArray_Count;

/**
 * The read timestamp at which the delete was observed.
 *
 * Greater or equal to the `commit_time` of the delete.
 **/
@property(nonatomic, readwrite, strong, null_resettable) GPBTimestamp *readTime;
/** Test to see if @c readTime has been set. */
@property(nonatomic, readwrite) BOOL hasReadTime;

@end

#pragma mark - GCFSDocumentRemove

typedef GPB_ENUM(GCFSDocumentRemove_FieldNumber) {
  GCFSDocumentRemove_FieldNumber_Document = 1,
  GCFSDocumentRemove_FieldNumber_RemovedTargetIdsArray = 2,
  GCFSDocumentRemove_FieldNumber_ReadTime = 4,
};

/**
 * A [Document][google.firestore.v1beta1.Document] has been removed from the view of the targets.
 *
 * Sent if the document is no longer relevant to a target and is out of view.
 * Can be sent instead of a DocumentDelete or a DocumentChange if the server
 * can not send the new value of the document.
 *
 * Multiple [DocumentRemove][google.firestore.v1beta1.DocumentRemove] messages may be returned for the same logical
 * write or delete, if multiple targets are affected.
 **/
@interface GCFSDocumentRemove : GPBMessage

/** The resource name of the [Document][google.firestore.v1beta1.Document] that has gone out of view. */
@property(nonatomic, readwrite, copy, null_resettable) NSString *document;

/** A set of target IDs for targets that previously matched this document. */
@property(nonatomic, readwrite, strong, null_resettable) GPBInt32Array *removedTargetIdsArray;
/** The number of items in @c removedTargetIdsArray without causing the array to be created. */
@property(nonatomic, readonly) NSUInteger removedTargetIdsArray_Count;

/**
 * The read timestamp at which the remove was observed.
 *
 * Greater or equal to the `commit_time` of the change/delete/remove.
 **/
@property(nonatomic, readwrite, strong, null_resettable) GPBTimestamp *readTime;
/** Test to see if @c readTime has been set. */
@property(nonatomic, readwrite) BOOL hasReadTime;

@end

#pragma mark - GCFSExistenceFilter

typedef GPB_ENUM(GCFSExistenceFilter_FieldNumber) {
  GCFSExistenceFilter_FieldNumber_TargetId = 1,
  GCFSExistenceFilter_FieldNumber_Count = 2,
};

/**
 * A digest of all the documents that match a given target.
 **/
@interface GCFSExistenceFilter : GPBMessage

/** The target ID to which this filter applies. */
@property(nonatomic, readwrite) int32_t targetId;

/**
 * The total count of documents that match [target_id][google.firestore.v1beta1.ExistenceFilter.target_id].
 *
 * If different from the count of documents in the client that match, the
 * client must manually determine which documents no longer match the target.
 **/
@property(nonatomic, readwrite) int32_t count;

@end

NS_ASSUME_NONNULL_END

CF_EXTERN_C_END

#pragma clang diagnostic pop

// @@protoc_insertion_point(global_scope)
